#include<stdio.h>



int main()
{
    int a,b;
    int arr[50][5]={0};
    int x,y;
    float ave[50]={0};
    float sum=0;
    x=0;
    y=0;

    scanf("%d %d",&a,&b);
    int max=0;
    int min=100;
    for(int i=0;i<a;i++)
    {
        sum=0;
        for(int j=0;j<b;j++)
        {
            scanf("%d",&arr[i][j]);
            sum=sum+arr[i][j];
            if(max<arr[i][j])
            {
                max=arr[i][j];
            }
            if(min>arr[i][j])
            {
                min=arr[i][j];
            }
        }
        ave[i]=sum/b;
    }
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<b;j++)
        {
            printf("%-5d",arr[i][j]);
        }
            printf("\n");
    }

    printf("Lowest grade: %d\n", min);
    printf("Highest grade: %d\n",max);
    for(int i=0;i<a;i++)
    {
        printf("The average grade for student %d is %.2f\n",i,ave[i]);
    }

}



